package com.munoor.dalai.server.model;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The persistent class for the LISTING database table.
 * 
 */
@Entity
@Table(name="LISTINGS")
@NamedQueries({
	@NamedQuery(name = "Listing.findByListingId", query = "SELECT l FROM Listing l WHERE l.listingId = :listingId"),
	@NamedQuery(name = "Listing.findAll", query = "SELECT l FROM Listing l WHERE l.released > :lastScan ORDER BY l.released"),
	
	@NamedQuery(name = "Listing.findByLocation", query = "SELECT l FROM Listing l WHERE l.locationId = :locationId AND l.released > :lastScan ORDER BY l.released"),	
	@NamedQuery(name = "Listing.findByLevel", query = "SELECT l FROM Listing l WHERE l.levelId = :levelId AND l.released > :lastScan ORDER BY l.released"),
	@NamedQuery(name = "Listing.findByLevelLocation", query = "SELECT l FROM Listing l WHERE l.levelId = :levelId AND l.locationId = :locationId AND l.released > :lastScan ORDER BY l.released"),	
	@NamedQuery(name = "Listing.findByCategory", query = "SELECT l FROM Listing l WHERE l.categoryId = :categoryId AND l.released > :lastScan ORDER BY l.released"),
	@NamedQuery(name = "Listing.findByCategoryLocation", query = "SELECT l FROM Listing l WHERE l.categoryId = :categoryId AND l.locationId = :locationId AND l.released > :lastScan ORDER BY l.released"),
	@NamedQuery(name = "Listing.findByCategoryLevel", query = "SELECT l FROM Listing l WHERE l.categoryId = :categoryId AND l.levelId = :levelId AND l.released > :lastScan ORDER BY l.released"),
	@NamedQuery(name = "Listing.findByCategoryLevelLocation", query = "SELECT l FROM Listing l WHERE l.categoryId = :categoryId AND l.levelId = :levelId AND l.locationId = :locationId AND l.released > :lastScan ORDER BY l.released"),

	@NamedQuery(name = "Listing.countAll", query = "SELECT COUNT(l) FROM Listing l WHERE l.released > :lastScan"),
	@NamedQuery(name = "Listing.countByLocation", query = "SELECT  COUNT(l) FROM Listing l WHERE l.locationId = :locationId AND l.released > :lastScan"),	
	@NamedQuery(name = "Listing.countByLevel", query = "SELECT  COUNT(l) FROM Listing l WHERE l.levelId = :levelId AND l.released > :lastScan"),
	@NamedQuery(name = "Listing.countByLevelLocation", query = "SELECT  COUNT(l) FROM Listing l WHERE l.levelId = :levelId AND l.locationId = :locationId AND l.released > :lastScan"),	
	@NamedQuery(name = "Listing.countByCategory", query = "SELECT COUNT(l) FROM Listing l WHERE l.categoryId = :categoryId AND l.released > :lastScan"),
	@NamedQuery(name = "Listing.countByCategoryLocation", query = "SELECT COUNT(l) FROM Listing l WHERE l.categoryId = :categoryId AND l.locationId = :locationId AND l.released > :lastScan"),
	@NamedQuery(name = "Listing.countByCategoryLevel", query = "SELECT COUNT(l) FROM Listing l WHERE l.categoryId = :categoryId AND l.levelId = :levelId AND l.released > :lastScan"),
	@NamedQuery(name = "Listing.countByCategoryLevelLocation", query = "SELECT COUNT(l) FROM Listing l WHERE l.categoryId = :categoryId AND l.levelId = :levelId AND l.locationId = :locationId AND l.released > :lastScan")})
	
public class Listing implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="LISTING_ID")
	private Long listingId;

	@Column(name="AGE_MAX")
	private int ageMax;

	@Column(name="AGE_MIN")
	private int ageMin;

	@Column(name="CATEGORY_ID")
	private short categoryId;

	@Column(name="COMPANY_ID")
	private long companyId;

	@Column(name="LEVEL_ID")
	private short levelId;

	@Column(name="LOCATION_ID")
	private String locationId;

	@Column(name="LONG_DESC")
	private String longDesc;

	@Column(name="SALARY_MAX")
	private int salaryMax;

	@Column(name="SALARY_MIN")
	private int salaryMin;

	@Column(name="SOURCE_ID")
	private long sourceId;

	private String title;

	private int views;
	
	private short active;
	
	private long expiry;
	
	private long released;

	public Listing() {
    }

	public long getListingId() {
		return this.listingId;
	}

	public void setListingId(long listingId) {
		this.listingId = listingId;
	}

	public int getAgeMax() {
		return this.ageMax;
	}

	public void setAgeMax(int ageMax) {
		this.ageMax = ageMax;
	}

	public int getAgeMin() {
		return this.ageMin;
	}

	public void setAgeMin(int ageMin) {
		this.ageMin = ageMin;
	}

	public short getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(short categoryId) {
		this.categoryId = categoryId;
	}

	public long getCompanyId() {
		return this.companyId;
	}

	public void setCompanyId(long companyId) {
		this.companyId = companyId;
	}

	public long getExpiry() {
		return this.expiry;
	}

	public void setExpiry(long expiry) {
		this.expiry = expiry;
	}

	public short getLevelId() {
		return this.levelId;
	}

	public void setLevelId(short levelId) {
		this.levelId = levelId;
	}

	public String getLocationId() {
		return locationId;
	}

	public void setLocationId(String locationId) {
		this.locationId = locationId;
	}

	public String getLongDesc() {
		return this.longDesc;
	}

	public void setLongDesc(String longDesc) {
		this.longDesc = longDesc;
	}

	public long getReleased() {
		return this.released;
	}

	public void setReleased(long released) {
		this.released = released;
	}

	public int getSalaryMax() {
		return this.salaryMax;
	}

	public void setSalaryMax(int salaryMax) {
		this.salaryMax = salaryMax;
	}

	public int getSalaryMin() {
		return this.salaryMin;
	}

	public void setSalaryMin(int salaryMin) {
		this.salaryMin = salaryMin;
	}

    public long getSourceId() {
		return this.sourceId;
	}

	public void setSourceId(long sourceId) {
		this.sourceId = sourceId;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getViews() {
		return this.views;
	}

	public void setViews(int views) {
		this.views = views;
	}

	public short getActive() {
		return this.active;
	}

	public void setActive(short active) {
		this.active = active;
	}
}